﻿using System;
using System.Linq;
using System.Linq.Expressions;
using ASPItalia.ModelVirtualCasting.Common;
using ASPItalia.ModelVirtualCasting.ObjectModel;

namespace ASPItalia.ModelVirtualCasting.EntityFramework
{
	public class LanguageRepository : BaseRepository<Language>, ILanguageRepository
	{
		public LanguageRepository(IContextContainer container) : base(container) { }

		public IQueryable<Language> GetAll()
		{
			return CurrentObjectQuery;
		}

		public IQueryable<Language> Where(Expression<Func<Language, bool>> predicate)
		{
			return CurrentObjectQuery.Where(predicate);
		}

		public long Count(Expression<Func<Language, bool>> predicate)
		{
			return CurrentObjectQuery.Count(predicate);
		}

		public ILanguageRepository Include(params string[] paths)
		{
			CurrentObjectQuery = CreateObjectQuery();
			return this;
		}

		public ILanguageRepository EnableLazyLoading()
		{
			SetLazyLoading(true);
			return this;
		}

		public ILanguageRepository DisableLazyLoading()
		{
			SetLazyLoading(false);
			return this;

		}
	}
}